//
//  HttpManager.m
//  RACDemo
//
//  Created by XFB on 2018/8/8.
//  Copyright © 2018年 ZhouCheng. All rights reserved.
//

#import "HttpManager.h"
#import "AFNetworking.h"

@implementation HttpManager

+ (void)POST:(NSString *)URLString
  parameters:(id)parameters
    progress:(void (^)(NSProgress *progress))uploadProgress
     success:(void (^)(NSURLSessionTask *task, id responseObject))success
     failure:(void (^)(NSURLSessionTask *task, NSError *error))failure
{
    AFHTTPSessionManager *manger = [AFHTTPSessionManager manager];

    /// 自定义请求为JSON格式
    manger.requestSerializer = [AFJSONRequestSerializer serializer];

    /// 自定义响应
    AFHTTPResponseSerializer *responseSerializer = [AFJSONResponseSerializer serializer];

    responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];

    manger.responseSerializer = responseSerializer;

    [manger POST:URLString parameters:parameters progress:nil success:success failure:failure];
}

@end
